Integer and memory overflow fixes for display code.
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 28 Jul 2011 21:31:33 +0000 (14:31 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 28 Jul 2011 21:31:33 +0000 (14:31 -0700)
commit233ca442302be63930a0a49711042d5607fb591b
tree3e39ef475c50e394f0ce41e53240612b6ebd559c
parentdfc17bc6dd9b4ba9feb22fa0c0f198c7f000c800
Integer and memory overflow fixes for display code.

* dispextern.h (struct glyph_pool.nglyphs): Now ptrdiff_t, not int.
* dispnew.c (adjust_glyph_matrix, realloc_glyph_pool, scrolling_window):
Check for overflow in size calculations.
(line_draw_cost, realloc_glyph_pool, add_row_entry):
Don't assume glyph table len fits in int.
(struct row_entry.bucket, row_entry_pool_size, row_entry_idx)
(row_table_size): Now ptrdiff_t, not int.
(scrolling_window): Avoid overflow in size calculations.
Don't update size until allocation succeeds.
* fns.c (concat): Check for overflow in size calculations.
(next_almost_prime): Verify NEXT_ALMOST_PRIME_LIMIT.
* lisp.h (RANGED_INTEGERP, TYPE_RANGED_INTEGERP): New macros.
(NEXT_ALMOST_PRIME_LIMIT): New constant.
src/ChangeLog
src/dispextern.h
src/dispnew.c
src/fns.c
src/lisp.h